package com.qingxin.park.entity;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 生产环节记录（农事作业信息）
 */
@Entity
@Table(name = "pro_record")
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
public class ProRecord extends com.qingxin.sys.entity.BaseEntity implements
		java.io.Serializable {
	private static final long serialVersionUID = 9216614929488249532L;
	// Fields

	private String recordid;
	private ParkBlockPlant parkBlockPlant;
	private String linkid;
	private String linkName;
	private Integer linkType;//种植（0基本环节、1种子环节、2施肥环节、3植保环节、4采收环节）养殖（0基本环节、1喂养环节、2防疫环节、3出栏环节）加工（0基本环节、1特殊环节、2成品环节）
	private String jobname;
	private String keyjob;//关键作业：0否1是
	@DateTimeFormat(pattern="yyyy-MM-dd")
	private Date workdate;
	private String worktime;//时间：1上午2下午
	private String worker;
	private String workerName;
	private String plantStatus;//作物状态：0=未成熟、1=已成熟
	private String remark;
	private String isdel;//删除状态：0正常，1已删除
	private String createBy;
	private Date createTime;
	private String updateBy;
	private Date updateTime;
	private Set<ProRecordMaterial> proRecordMaterials = new HashSet<>(0);
	private Set<ProRecordImgs> proRecordImgses = new HashSet<>(0);

	// Constructors

	/** default constructor */
	public ProRecord() {
	}

	/** minimal constructor */
	public ProRecord(ParkBlockPlant parkBlockPlant) {
		this.parkBlockPlant = parkBlockPlant;
	}

	/** full constructor */
	public ProRecord(ParkBlockPlant parkBlockPlant, String linkid, String linkName,
			Integer linkType, String jobname, String keyjob, Date workdate, String worktime,
			String worker, String workerName, String plantStatus, String remark, String createBy,
			Date createTime, String updateBy, Date updateTime,
			Set<ProRecordMaterial> proRecordMaterials,
			Set<ProRecordImgs> proRecordImgses) {
		this.parkBlockPlant = parkBlockPlant;
		this.linkid = linkid;
		this.linkName = linkName;
		this.linkType = linkType;
		this.jobname = jobname;
		this.keyjob = keyjob;
		this.workdate = workdate;
		this.worktime = worktime;
		this.worker = worker;
		this.workerName = workerName;
		this.plantStatus = plantStatus;
		this.remark = remark;
		this.createBy = createBy;
		this.createTime = createTime;
		this.updateBy = updateBy;
		this.updateTime = updateTime;
		this.proRecordMaterials = proRecordMaterials;
		this.proRecordImgses = proRecordImgses;
	}

	// Property accessors
	@GenericGenerator(name = "generator", strategy = "uuid.hex")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "recordid", unique = true, nullable = false, length = 32)
	public String getRecordid() {
		return this.recordid;
	}

	public void setRecordid(String recordid) {
		this.recordid = recordid;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "plantid", nullable = false)
	public ParkBlockPlant getParkBlockPlant() {
		return this.parkBlockPlant;
	}

	public void setParkBlockPlant(ParkBlockPlant parkBlockPlant) {
		this.parkBlockPlant = parkBlockPlant;
	}

	@Column(name = "linkid", length = 32)
	public String getLinkid() {
		return this.linkid;
	}

	public void setLinkid(String linkid) {
		this.linkid = linkid;
	}
	
	@Column(name = "link_name", length = 50)
	public String getLinkName() {
		return this.linkName;
	}

	public void setLinkName(String linkName) {
		this.linkName = linkName;
	}
	
	@Column(name = "link_type")
	public Integer getLinkType() {
		return linkType;
	}

	public void setLinkType(Integer linkType) {
		this.linkType = linkType;
	}

	@Column(name = "jobname", length = 50)
	public String getJobname() {
		return this.jobname;
	}

	public void setJobname(String jobname) {
		this.jobname = jobname;
	}

	@Column(name = "keyjob", length = 1)
	public String getKeyjob() {
		return this.keyjob;
	}

	public void setKeyjob(String keyjob) {
		this.keyjob = keyjob;
	}

	@Column(name = "workdate", length = 23)
	public Date getWorkdate() {
		return this.workdate;
	}

	public void setWorkdate(Date workdate) {
		this.workdate = workdate;
	}

	@Column(name = "worktime", length = 1)
	public String getWorktime() {
		return this.worktime;
	}

	public void setWorktime(String worktime) {
		this.worktime = worktime;
	}

	@Column(name = "worker", length = 32)
	public String getWorker() {
		return this.worker;
	}

	public void setWorker(String worker) {
		this.worker = worker;
	}

	@Column(name = "worker_name", length = 50)
	public String getWorkerName() {
		return workerName;
	}

	public void setWorkerName(String workerName) {
		this.workerName = workerName;
	}

	@Column(name = "plant_status", length = 1)
	public String getPlantStatus() {
		return this.plantStatus;
	}

	public void setPlantStatus(String plantStatus) {
		this.plantStatus = plantStatus;
	}
	
	@Column(name = "remark", length = 2000)
	public String getRemark() {
		return this.remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Column(name = "isdel", length = 1)
	public String getIsdel() {
		return isdel;
	}

	public void setIsdel(String isdel) {
		this.isdel = isdel;
	}

	@Column(name = "create_by", length = 32)
	public String getCreateBy() {
		return this.createBy;
	}

	public void setCreateBy(String createBy) {
		this.createBy = createBy;
	}

	@Column(name = "create_time", length = 23)
	public Date getCreateTime() {
		return this.createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@Column(name = "update_by", length = 32)
	public String getUpdateBy() {
		return this.updateBy;
	}

	public void setUpdateBy(String updateBy) {
		this.updateBy = updateBy;
	}

	@Column(name = "update_time", length = 23)
	public Date getUpdateTime() {
		return this.updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "proRecord")
	@JsonIgnore
	public Set<ProRecordMaterial> getProRecordMaterials() {
		return this.proRecordMaterials;
	}

	public void setProRecordMaterials(Set<ProRecordMaterial> proRecordMaterials) {
		this.proRecordMaterials = proRecordMaterials;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "proRecord")
	@JsonIgnore
	public Set<ProRecordImgs> getProRecordImgses() {
		return this.proRecordImgses;
	}

	public void setProRecordImgses(Set<ProRecordImgs> proRecordImgses) {
		this.proRecordImgses = proRecordImgses;
	}

}